﻿@page "/diarySetting"
@namespace SwashbucklerDiary.Rcl.Pages
@inherits ImportantComponentBase

<MyAppBar Title="@(I18n.T("Setting.Display.Diary.Name"))"
          OnClick="NavigateToBack">
</MyAppBar>

<ScrollContainer>
    <MCard Class="list-item-card"
           Elevation="0"
           Rounded="@("lg")">
        <MList>
            <MListItem>
                <MListItemIcon>
                    <MIcon Class="list-item-icon">
                        mdi-format-title
                    </MIcon>
                </MListItemIcon>
                <MListItemContent>
                    @(I18n.T("Setting.Display.Diary.Title.Name"))
                </MListItemContent>
                <MListItemAction>
                    <MSwitch @bind-Value="title"
                             TValue="bool"
                             OnChange="SettingChange(Setting.Title)"
                             Dense="true"
                             Inset="true"
                             Color="white">
                    </MSwitch>
                </MListItemAction>
            </MListItem>

            <MDivider Class="mx-3"></MDivider>

            <MListItem>
                <MListItemIcon>
                    <MIcon Class="list-item-icon">
                        mdi-language-markdown-outline
                    </MIcon>
                </MListItemIcon>
                <MListItemContent>
                    @(I18n.T("Setting.Display.Diary.Markdown.Name"))
                </MListItemContent>
                <MListItemAction>
                    <MSwitch @bind-Value="markdown"
                             TValue="bool"
                             OnChange="SettingChange(Setting.Markdown)"
                             Dense="true"
                             Inset="true"
                             Color="white">
                    </MSwitch>
                </MListItemAction>
            </MListItem>

            <MDivider Class="mx-3"></MDivider>

            <MListItem OnClick="()=>showEditAutoSave=true">
                <MListItemIcon>
                    <MIcon Class="list-item-icon">
                        mdi-content-save-edit-outline
                    </MIcon>
                </MListItemIcon>
                <MListItemContent>
                    @(I18n.T("Setting.Display.Diary.EditAutoSave.Name"))
                </MListItemContent>
                <MListItemContent Class="setting-state">
                    <MListItemSubtitle>
                        @EditAutoSaveText
                    </MListItemSubtitle>
                </MListItemContent>
                <MListItemAction>
                    <MIcon>mdi-chevron-right</MIcon>
                </MListItemAction>
            </MListItem>
        </MList>
    </MCard>

    <MCard Class="list-item-card"
           Elevation="0"
           Rounded="@("lg")">
        <MListItem OnClick="@(()=>To("locationSetting"))">
            <MListItemIcon>
                <MIcon Class="list-item-icon">
                    mdi-map-marker-outline
                </MIcon>
            </MListItemIcon>
            <MListItemContent>
                @(I18n.T("Setting.Display.Diary.Location.Name"))
            </MListItemContent>
            <MListItemAction>
                <MIcon>mdi-chevron-right</MIcon>
            </MListItemAction>
        </MListItem>
    </MCard>
</ScrollContainer>

<SelectDialog @bind-Visible="showEditAutoSave"
              @bind-Value="@EditAutoSave"
              Title="@(I18n.T("Setting.Display.Diary.EditAutoSave.Name"))"
              Items="editAutoSaveItems"
              Mandatory="true">
</SelectDialog>
